var t = getApp();

Page({
    data: {
        profitShow: !1,
        diyform: {
            form_id: "",
            diyform_data_id: "",
            pre_id: ""
        },
        networkLoading: !1,
        userInfo: {}
    },
    onLoad: function(t) {
        this.getData();
    },
    getData: function() {
        var o = this, e = t.getNetAddresss("plugin.consumer-reward.frontend.controllers.reward.index");
        t._postNetWork({
            url: e,
            success: function(e) {
                var n = e.data;
                if (1 != n.result) return t.tips(n.msg);
                o.setData({
                    userInfo: n.data,
                    "diyform.form_id": n.data.form_id,
                    networkLoading: !0
                }), wx.setNavigationBarTitle({
                    title: n.data.plugin_name || "消费"
                });
            }
        });
    },
    receive: function() {
        this.sendBtn();
    },
    setProfitShow: function() {
        this.setData({
            profitShow: !this.data.profitShow
        });
    },
    gotoRewardRecord: function() {
        wx.navigateTo({
            url: "/packageH/consumerReward/consumerRewardRecord/consumerRewardRecord"
        });
    },
    traCheckedData: function(t) {
        var o = t.detail.diyform_data_id;
        console.log(t), o && this.sendBtn(o);
    },
    sendBtn: function() {
        var o = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, n = {
            form_data_id: e,
            form_id: this.data.diyform.form_id
        }, r = t.getNetAddresss("plugin.consumer-reward.frontend.controllers.reward.receive-income");
        t._getNetWork({
            url: r,
            data: n,
            success: function(e) {
                var n = e.data;
                t.tips(n.msg), 1 == n.result && o.setData({
                    "userInfo.reward_record": 0,
                    profitShow: !1
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});